====================================================================== Microsoft Product Support Services Application Note (Text File) HF0405: CALLING DOS AND BIOS INTERRUPTS WITH FORTRAN AND MASM ====================================================================== Revision Date: 8/91 1 Disk Included This information applies to Microsoft FORTRAN versions 5.0 and 5.1. -------------------------------------------------------------------- | INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY | | ACCOMPANY THIS DOCUMENT (collectively referred to as an | | Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY | | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO | | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A | | PARTICULAR PURPOSE. The user assumes the entire risk as to the | | accuracy and the use of this Application Note. This Application | | Note may be copied and distributed subject to the following | | conditions: 1) All text must be copied without modification and | | all pages must be included; 2) If software is included, all files | | on the disk(s) must be copied without modification [the MS-DOS(R) | | utility DISKCOPY is appropriate for this purpose]; 3) All | | components of this Application Note must be distributed together; | | and 4) This Application Note may not be distributed for profit. | | | | Copyright 1991 Microsoft Corporation. All Rights Reserved. | | Microsoft, MS-DOS, and the Microsoft logo are registered | | trademarks and Windows is a trademark of Microsoft Corporation. | -------------------------------------------------------------------- This application note illustrates how to access DOS interrupts without using the functions INTDOS and INTDOSX. DOS and BIOS interrupts can be called by specifying the interrupt number and the input register values within the main program. INTERRUPT and INTERRUPTX differ from the INTDOS and INTDOSX routines included with FORTRAN in that interrupts other than interrupt 21 can be called. Included on the enclosed "Calling DOS and BIOS Interrupts with FORTRAN and MASM" disk are the following files. These files define the INTERRUPT and INTERRUPTX functions and provide two FORTRAN sample programs demonstrating how these functions are called. File Description ---- ----------- INTERRPT.ASM The assembly source listing of the INTERRUPT and INTERRUPTX routines. INTERRPT.INC An include file for INTERRUPT and INTERRUPTX. This file contains the INTERFACE to the assembly routines and the register structures needed for INTERRUPT and INTERRUPTX. INTERRPT.OBJ The preassembled version of INTERRPT.ASM to be linked with programs calling INTERRUPT or INTERRUPTX. INT.FOR FORTRAN sample program that demonstrates how to use the INTERRUPT function call. INT.FOR uses INT 21, function 2A hex to get the system date. INTX.FOR FORTRAN sample program using segment registers that demonstrates how to use the INTERRUPTX function call. INTXFOR uses INT 21, function 41 hex to delete a file. INT.EXE Executable version of INT.FOR example. INTX.EXE Executable version of INTX.FOR example. The two assembly language routines included in INTERRPT.ASM are as follows: 1. INTERRUPT(INTNUM,INREGS,OUTREGS) invokes the interrupt specified by INTNUM using the values of INREGS and returns the result of the interrupt call in OUTREGS. 2. INTERRUPTX(INTNUM,INREGS,OUTREGS) invokes the system in the same manner as INTERRUPT but accepts segment register values. To use the INTERRUPT and INTERRUPTX functions, the statement INCLUDE 'INTERRPT.INC' must be located at the top of the source file where a call is made to the assembly language procedures. The two statement function definitions documented at the end of the INTERRPT.INC file must be uncommented and added to the source code of any FORTRAN program, function, or subroutine block where the assembly language procedures are called. The statement functions documented at the end of INTERRPT.INC are shown below. These statement functions must appear before any executable statements. INTERRPT.OBJ must then be linked with the object file produced from compiling the main program. gethibyte (dataword) = dataword / 256 getlobyte (dataword) = iand(dataword , 255) Microsoft cannot guarantee that the information stated here regarding how to use INTERRUPT and INTERRUPTX will allow you to perform all MS- DOS system or BIOS calls correctly because this information has not been tested rigorously and is not considered a feature of the product.